create table LocationType
(
	 [LocationTypeId] int identity(1, 1) primary key
	,[LocationTypeName] nvarchar(128)
	,[CreatedBy] int
	,[CreatedDate] datetime
	,[UpdatedBy] int
	,[UpdatedDate] datetime
	,[Status] int
)
go

CREATE PROCEDURE LocationTypeGet
	@LocationTypeId int
AS
SELECT *
FROM [LocationType]
WHERE [LocationType].[LocationTypeId] = @LocationTypeId
GO

CREATE PROCEDURE LocationTypeList
AS
SELECT *
FROM [LocationType]
ORDER BY LocationTypeId DESC
GO

CREATE PROCEDURE LocationTypeInsert
	 @LocationTypeName nvarchar(128)
	,@CreatedBy int
	,@CreatedDate datetime
	,@UpdatedBy int
	,@UpdatedDate datetime
	,@Status int
AS

INSERT INTO LocationType (
	 [LocationTypeName]
	,[CreatedBy]
	,[CreatedDate]
	,[UpdatedBy]
	,[UpdatedDate]
	,[Status]
	
) VALUES (
	 @LocationTypeName
	,@CreatedBy
	,@CreatedDate
	,@UpdatedBy
	,@UpdatedDate
	,@Status
	
)

select SCOPE_IDENTITY()
GO

CREATE PROCEDURE LocationTypeUpdate
	@LocationTypeId int, 
	@LocationTypeName nvarchar(128), 
	@CreatedBy int, 
	@CreatedDate datetime, 
	@UpdatedBy int, 
	@UpdatedDate datetime, 
	@Status int 
AS
UPDATE LocationType SET
	   [LocationTypeName] = @LocationTypeName
	   ,[CreatedBy] = @CreatedBy
	   ,[CreatedDate] = @CreatedDate
	   ,[UpdatedBy] = @UpdatedBy
	   ,[UpdatedDate] = @UpdatedDate
	   ,[Status] = @Status
WHERE [LocationType].[LocationTypeId] = @LocationTypeId
GO

CREATE PROCEDURE LocationTypeDelete
	@LocationTypeId int
AS
DELETE FROM LocationType
WHERE [LocationType].[LocationTypeId] = @LocationTypeId
GO
